<?php
include '../common.php';

//方法属于类，所有对象都可以使用这个类方法


class ren{
    public $age;
    public $name="无名氏";
    
    const PI=3.1415926;//类常量的定义    
    function __construct($name=null,$age) {
        $this->name=$name?$name:$this->name;
        $this->age=$age;
    }    
    
    function  run(){
        echo $this->name."在奔跑…………年龄[{$this->age}]岁";
    }
    function eat(){
         echo "吃饭";
    }    
}
echo "<br/>";
$wangwu=new ren("王五",33);
$wangwu->run();
?>